{% load static %}
<!doctype html>
<html lang="zh">

<head>
	<meta charset="utf-8" />
	<title>Dashboard I Admin Panel</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="{% static 'tickets/CSS/Manager/layout.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'tickets/CSS/Manager/style.css' %}">
</head>

<body>
	<div class="tab_container">
		<div id="tab1" class="tab_content">
			<table class="tablesorter" cellspacing="0" cellpadding="8px">
				<colgroup>
					<col width="30"/>
					<col width="60"/>
					<col width="200"/>
					<col width="100"/>
					<col width="120"/>
					<col width="120"/>
					<col width="80"/>
					<col width="80"/>
					<col width="80"/>
					<col width="80"/>
					<col width="80"/>
					<col width="80"/>
					<col width="80"/>
					<col width="80"/>
					<col width="80"/>
					<col width="80"/>
					<col width="80"/>
				</colgroup>
				<thead>
					<tr>
						<th></th>
						<th>车次</th>
						<th>日期</th>
						<th>出发站<br>到达站</th>
						<th>出发时间<br>到达时间</th>
						<th>历时</th>
						<th>商务座</th>
						<th>一等座</th>
						<th>二等座</th>
						<th>高级软卧</th>
						<th>软卧</th>
						<th>动卧</th>
						<th>硬卧</th>
						<th>软座</th>
						<th>硬座</th>
						<th>无座</th>
						<th></th>
					</tr>
				</thead>
				<tbody>
                    {% for tran in tran_list %}
                    <tr id="Train{{ forloop.counter }}">
						<td><input type="checkbox"></td>
						<td>{{ tran.tran_code }}</td>
						<td>{{ tran.tran_date }}</td>
						<td>始: {{ tran.station_start }}<br>终: {{ tran.station_arriv }}</td>
						<td>发车:{{ tran.tran_strt }}<br>到站:{{ tran.tran_endt }}</td>
						<td>时长:{{ tran.tran_clip }}</td>
						<td>{{ tran.seat_busine }}</td>
						<td>{{ tran.seat_firstt }}</td>
						<td>{{ tran.seat_second }}</td>
						<td>{{ tran.seat_advsft }}</td>
						<td>{{ tran.seat_sftslp }}</td>
						<td>{{ tran.seat_bltslp }}</td>
						<td>{{ tran.seat_hrdslp }}</td>
						<td>{{ tran.seat_softer }}</td>
						<td>{{ tran.seat_harder }}</td>
						<td>{{ tran.seat_noleft }}</td>
						<td class="a">
                            <input type="image" width="16px" height="16px" src="{% static 'tickets/images/Manager/icn_edit_before.png' %}"
								onmouseover=this.src="{% static 'tickets/images/Manager/icn_edit_after.png' %}"
								onmouseout=this.src="{% static 'tickets/images/Manager/icn_edit_before.png' %}" title="Edit" id="js_show">
							<input type="image" width="16px" height="16px" src="{% static 'tickets/images/Manager/icn_trash_before.png' %}"
								onmouseover=this.src="{% static 'tickets/images/Manager/icn_trash_after.png' %}"
								onmouseout=this.src="{% static 'tickets/images/Manager/icn_trash_before.png' %}" title="Trash">
						</td>
					</tr>
                    {% endfor %}	
				</tbody>
				<!-- 弹窗 -->
				<div class="modal">
					<div class="modal-content center-main">
						<div class="modal-body panel-border">
							<div class="mb_revise">
								<div class="center-tit">
									<div class="tit-name">基本信息</div>
								</div>
								<div class="form-list">
									<div class="form-item">
										<div class="form-label">
											商务座：
										</div>
										<div class="form-bd">
											<div class="jiajian">

												<input class="jian" type="button" value="-"
													onclick="reductionOf(this)" />

												<input class="wenben" type="text" value="1" id="num6"
													onblur="checkNumber(this)" />

												<input class="jian" type="button" value="+" onclick="add(this)" />

											</div>
										</div>
									</div>
								</div>
								<div class="form-list">
									<div class="form-item">
										<div class="form-label">
											一等座：
										</div>
										<div class="form-bd">
											<div class="jiajian">

												<input class="jian" type="button" value="-"
													onclick="reductionOf(this)" />

												<input class="wenben" type="text" value="1" id="num7"
													onblur="checkNumber(this)" />

												<input class="jian" type="button" value="+" onclick="add(this)" />

											</div>
										</div>
									</div>
								</div>
								<div class="form-list">
									<div class="form-item">
										<div class="form-label">
											二等座：
										</div>
										<div class="form-bd">
											<div class="jiajian">

												<input class="jian" type="button" value="-"
													onclick="reductionOf(this)" />

												<input class="wenben" type="text" value="1" id="num8"
													onblur="checkNumber(this)" />

												<input class="jian" type="button" value="+" onclick="add(this)" />

											</div>
										</div>
									</div>
								</div>
								<div class="form-list">
									<div class="form-item">
										<div class="form-label">
											高级软卧：
										</div>
										<div class="form-bd">
											<div class="jiajian">

												<input class="jian" type="button" value="-"
													onclick="reductionOf(this)" />

												<input class="wenben" type="text" value="1" id="num9"
													onblur="checkNumber(this)" />

												<input class="jian" type="button" value="+" onclick="add(this)" />

											</div>
										</div>
									</div>
								</div>
								<div class="form-list">
									<div class="form-item">
										<div class="form-label">
											软卧：
										</div>
										<div class="form-bd">
											<div class="jiajian">

												<input class="jian" type="button" value="-"
													onclick="reductionOf(this)" />

												<input class="wenben" type="text" value="1" id="num10"
													onblur="checkNumber(this)" />

												<input class="jian" type="button" value="+" onclick="add(this)" />

											</div>
										</div>
									</div>
								</div>
								<div class="form-list">
									<div class="form-item">
										<div class="form-label">
											动卧：
										</div>
										<div class="form-bd">
											<div class="jiajian">

												<input class="jian" type="button" value="-"
													onclick="reductionOf(this)" />

												<input class="wenben" type="text" value="1" id="num11"
													onblur="checkNumber(this)" />

												<input class="jian" type="button" value="+" onclick="add(this)" />

											</div>
										</div>
									</div>
								</div>
								<div class="form-list">
									<div class="form-item">
										<div class="form-label">
											硬卧：
										</div>
										<div class="form-bd">
											<div class="jiajian">

												<input class="jian" type="button" value="-"
													onclick="reductionOf(this)" />

												<input class="wenben" type="text" value="1" id="num12"
													onblur="checkNumber(this)" />

												<input class="jian" type="button" value="+" onclick="add(this)" />

											</div>
										</div>
									</div>
								</div>
								<div class="form-list">
									<div class="form-item">
										<div class="form-label">
											软座：
										</div>
										<div class="form-bd">
											<div class="jiajian">

												<input class="jian" type="button" value="-"
													onclick="reductionOf(this)" />

												<input class="wenben" type="text" value="1" id="num13"
													onblur="checkNumber(this)" />

												<input class="jian" type="button" value="+" onclick="add(this)" />

											</div>
										</div>
									</div>
								</div>
								<div class="form-list">
									<div class="form-item">
										<div class="form-label">
											硬座：
										</div>
										<div class="form-bd">
											<div class="jiajian">

												<input class="jian" type="button" value="-"
													onclick="reductionOf(this)" />

												<input class="wenben" type="text" value="1" id="num14"
													onblur="checkNumber(this)" />

												<input class="jian" type="button" value="+" onclick="add(this)" />

											</div>
										</div>
									</div>
								</div>
								<div class="form-list">
									<div class="form-item">
										<div class="form-label">
											无座：
										</div>
										<div class="form-bd">
											<div class="jiajian">

												<input class="jian" type="button" value="-"
													onclick="reductionOf(this)" />

												<input class="wenben" type="text" value="1" id="num15"
													onblur="checkNumber(this)" />

												<input class="jian" type="button" value="+" onclick="add(this)" />

											</div>
										</div>
									</div>
								</div>
							</div>
							<button class="determine" id="btn_submit">确定</button><button class="cancen">取消</button>
						</div>
					</div>
				</div>

			</table>
		</div>

</body>
<script type="text/javascript" src="{% static 'tickets/JS/Manager/jquery-3.4.1.js'%}"></script>
<script type="text/javascript" src="{% static 'tickets/JS/Manager/script.js'%}"></script>
<script>

	//减数量
	function reductionOf(obj) {
		//减前判断
		if ($(obj).next().val() == '') {
			$(obj).next().val(1);
		}
		if ($(obj).next().val() != 1) {
			$(obj).next().val(parseInt($(obj).next().val()) - 1);//数值减
			$(obj).next().val($(obj).next().val());//赋值给框
		}

	};
	//加数量
	function add(obj) {
		//加前判断
		if ($(obj).prev().val() == '') {
			$(obj).prev().val(1);
		}
		$(obj).prev().val(parseInt($(obj).prev().val()) + 1);//数值加
		$(obj).prev().val($(obj).prev().val());//赋值给框
	};
	//校验数字格式（只能输入正整数）
	function checkNumber(obj) {
		var reg = /^[1-9]\d*$/;
		if (!reg.test($(obj).val()) || $(obj).val() == '') {
			$(obj).val(1);
		}
	}
	$(document).ready(function() {
    $('#btn_submit').click(function () {
        alert(document.getElementById("num0").value);

    });
	
})
</script>

</html>